package com.jingtai.platform.controller.admin;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.admin.PlatformRole;
import com.jingtai.platform.service.admin.PlatformRoleService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 
 *
 * @author sunlaiqian
 * @date 2020-12-04 19:30:36
 */
@RestController
@RequestMapping("/platform/platformrole")
@Api(tags = "")
public class PlatformRoleController{

    @Autowired
    private PlatformRoleService platformRoleService;


    @ApiOperation("列表查询")
    @GetMapping("/list")
    public ResultUtil aopPlatformRoleList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return platformRoleService.PlatformRolelist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询platformRole实体")
    @GetMapping("/getPlatformRoleById")
    public ResultUtil GetPlatformRoleById(@CApiParam(name = "id",value = "platformRole实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return platformRoleService.getPlatformRoleById(id);
    }


    @ApiOperation("新增platformRole实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"platformRole.id","platformRole.createTime","platformRole.updateTime","platformRole.deleteFlag"})
    public ResultUtil aopAddPlatformRole(@RequestBody @Validated({BaseEntity.Create.class}) PlatformRole platformRole){
        return platformRoleService.addPlatformRole(platformRole);
    }

    @ApiOperation("编辑platformRole实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"platformRole.createTime","platformRole.updateTime","platformRole.deleteFlag"})
    public ResultUtil aopEditPlatformRole(@RequestBody @Validated({BaseEntity.Update.class}) PlatformRole platformRole){
        return platformRoleService.editPlatformRole(platformRole);
    }

    @ApiOperation("根据ID删除platformRole实体")
    @GetMapping("/delPlatformRoleById")
    public ResultUtil aopDelPlatformRoleById(@CApiParam(name = "id",value = "platformRole实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return platformRoleService.delPlatformRoleById(id);
    }

    @ApiOperation("查询所有角色")
    @GetMapping("/selectAllRole")
    public ResultUtil aopelectAllRole(){
        return platformRoleService.selectAllRole();
    }


}






